FROM node:16-alpine3.11 as build
WORKDIR /build
ADD package.json ./package.json
RUN npm config set registry https://registry.npm.taobao.org
RUN npm i -g yarn tyarn --force
RUN tyarn

COPY . .
RUN tyarn build

FROM nginx
WORKDIR /usr/share/nginx/html/
ADD default.conf /etc/nginx/conf.d/
COPY --from=build /build/dist .
EXPOSE 80
